// SINGULARITY HTML5 GAME ENGINE
// -----------------------------
// Copyright(c) 2013 by Codenova.pl

define(['../Core'], function (Core) {
    var ButtonGroup = function(objButtonGroup) {
        this.Background = objButtonGroup.Background;
        this.ButtonBackground = objButtonGroup.ButtonBackground;
        this.ButtonHeight = objButtonGroup.ButtonHeight;
        this.ButtonWidth = objButtonGroup.ButtonWidth;
        this.Height = objButtonGroup.Height;
        this.Width = objButtonGroup.Width;
        this.X = objButtonGroup.X;
        this.Y = objButtonGroup.Y;
    };

    ButtonGroup.prototype = {
        constructor: ButtonGroup,

        Add: function(ctx) {
            // If X/Y are set for 'auto', center button group relative
            // to window borders
            this.X = Core.CenterDimensionToWindow(this.X, this.Width, 'width');
            this.Y = Core.CenterDimensionToWindow(this.Y, this.Height, 'height');

            Core.DrawRectangle(ctx, this.X, this.Y, this.Width, this.Height, this.Background);
        },

        Create: function(objButtonGroup) {
            return new ButtonGroup(objButtonGroup);
        }
    };

    return ButtonGroup.prototype.Create;
});